import pygame

from settings import Settings
import error

mc_settings = Settings()
class Block():
    def __init__(self, ID, name, module='minecraft', texture=None):
        self.ID = int(ID)
        self.name = name
        self.module = module
        try:
            if texture != None:
                self.texture_path = mc_settings.texture_path + texture
                self.texture = pygame.image.load(self.texture_path)
        except:
            raise error.TesxtureMissingError(self.texture_path)
    
    def __str__(self):
        return f'<Block {self.module}.{self.name} with ID {self.ID}>'

air = Block(0, 'air')
stone = Block(1, 'stone', texture='stone.bmp')
grass = Block(2, 'grass', texture='grass.bmp')
dirt = Block(3, 'dirt', texture='dirt.bmp')

blocks = {
    0:air,
    1:stone,
    2:grass,
    3:dirt,
}